IDEA解决 Could not Autowired,No Beans of 'Mapper' type found 报错

作者: 李多多 日期: 2019-11-13
IDEA
IDEA解决 Could not Autowired,No Beans of 'Mapper' type found 报错

错误如下,网上大多数的说法都是要求我们把这个提示功能关闭,解决如下:
image.png

  1. 在mapper文件上加 @Repository 注解,这是从spring2.0新增的一个注解,用于简化 Spring 的开发,实现数据访问

  2. 在mapper文件上加 @Component 注解,把普通pojo实例化到spring容器中,相当于配置文件中的 < bean id=”” class=””/>